home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC Media 22
/
PC MEDIA CD22.iso
/
share
/
prog
/
rodent
/
4.asm
< prev
next >
Wrap
Assembly Source File
|
1995-08-19
|
2KB
|
115 lines
; This is just for fun. Use the mouse to "scribble" on the screen.
.model small
.stack 0100h
.data
cx_save dw ?
esdx_save dd ?
message db 176,176,176,177,177,178,16,"$"
.code
start:
; set screen mode, and clear the screen
mov ah, 00h
mov al, 03h
int 10h
mov ax, 0b800h
mov es, ax
mov di, 0000h
mov ax, 1700h
mov cx, 0fa0h
cld
repz
stosw
; begin mouse routines
mov ax, 0000h ; initialize mouse
int 33h
mov ax, 0001h ; show mouse cursor
int 33h
mov ax, 0014h
mov cx, 03h ; act on mouse move or left button press
push cs
pop es
mov dx, offset cs:mouse
int 33h
mov [cx_save], cx
mov [word ptr esdx_save], es
mov [word ptr esdx_save+2],dx
mov ah, 00h
int 16h
mov ax, 0000h ; re-initialize mouse
int 33h
mov ax, 0002h ; hide cursor
int 33h
mov cx, [cx_save]
mov es, [word ptr esdx_save]
mov dx, [word ptr esdx_save+2]
mov ax, 0014h
int 33h
mov ax, 0b800h
mov es, ax
mov di, 0000h
mov ax, 1700h
mov cx, 0fa0h
cld
repz
stosw
; set cursor size
mov ah, 01h
mov ch, 7
mov cl, 8
int 10h
; terminate
mov ah, 04ch
int 21h
mouse proc
push dx
push ax
push cx
mov bl, 8
push cx
push dx
pop ax
div bl
mov dh, al
pop ax
div bl
mov dl, al
mov ah, 02h
mov bh, 00h
int 10h
; set cursor size
mov ah, 01h
mov ch, 1
mov cl, 0
int 10h
mov ax, @data
mov ds, ax
mov dx, offset message
mov ah, 09h
int 21h
pop cx
pop ax
pop dx
mouse endp
retf ; this is a "far" procedure
end start